package cn.driver.manager.mapper;

import cn.driver.common.pojo.Notice;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

@Mapper
public interface NoticeMapper {
    @Select("select id, title, annouce_time, publisher, `text`, cover from notice;")
    List<Notice> getNoticeList();

    @Insert("insert into notice (title, annouce_time, `text`, publisher, cover) values (#{title}, #{annouceTime}, #{text}, #{publisher}, #{cover})")
    int addNotice(String title, Date annouceTime, String text, String publisher, String cover);

    @Update("update notice set title = #{title}, `text` = #{text}, cover = #{cover} where id = #{id}")
    int updateNotice(int id, String title, String text, String cover);

    @Delete("delete from notice where id = #{id}")
    int deleteNotice(int id);
}
